package com.ap.core.validation.message.rules;

import com.ap.core.cxf.jaxb.common.ActivationStatus;
import com.ap.core.dao.MerchantDao;
import com.ap.core.domain.Merchant;
import com.ap.core.validation.message.info.MessageValidationInfo;
import com.ap.core.validation.rules.AbstractValidationRule;

public abstract class AbstractMerchantCheckRule<T,OI> extends AbstractValidationRule<MessageValidationInfo<T,OI>> {
	
	  private MerchantDao merchantDao;
	  
	  protected boolean isMerchantActive(String merchantIdentification){
		  final Merchant merchant = merchantDao.getMerchantByIdentification(merchantIdentification);
	       return null != merchant && merchant.getActivationStatus() == ActivationStatus.ACTIVE;
	  }
	  
	
	  public void setMerchantDao(MerchantDao merchantDao) {
	        this.merchantDao = merchantDao;
	    }
	  
		abstract public boolean validate(MessageValidationInfo<T,OI> infoObject);


}
